package com.mly.controller;

import com.alibaba.fastjson.JSONObject;
import com.mly.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import orm.base.Ex.BaseControllerEx;
import orm.config.UnAuth;

import java.util.Map;

/**
 * Created by ashin on 2018/3/27.
 */
@Controller
@Scope("prototype")
@RequestMapping("article")
public class ArticleController extends BaseControllerEx {

    @Autowired
    ArticleService articleService;

    @Override
    protected void init() {
        super.init(articleService);
    }

    @UnAuth
    @RequestMapping(value = "/doQueryTypes", method = RequestMethod.POST)
    public JSONObject doQueryTypes(@RequestParam Map map) throws Exception{
        return articleService.queryArticles(map);
    }

    @UnAuth
    @RequestMapping(value = "/doSelectType", method = RequestMethod.POST)
    public JSONObject doSelectType(@RequestParam Map map) throws Exception{
        return articleService.selectArticle(map);
    }
}
